{include file="styles/header.tpl"}
<div id="content" class="box">
	<h1>Supplier Calendar</h1>
	<fieldset>
		<legend>Search</legend>
		<form method="get" action="">
			<label>Supplier Name or Id: </label><input type="text" size="40" name="name" value="{$strName}" >
			<label>&nbsp;&nbsp;
			<select name="weekday" >
				<option value ="" {if $strWeekday==""} selected="seleted" {/if}>Day of week </option>
				<option value ="mon" {if $strWeekday=="mon"} selected="seleted" {/if}> Monday </option>
				<option value ="tue" {if $strWeekday=="tue"} selected="seleted" {/if}> Tuesday </option>
				<option value ="wed" {if $strWeekday=="wed"} selected="seleted" {/if}> Wednesday </option>
				<option value ="thu" {if $strWeekday=="thu"} selected="seleted" {/if}> Thurday </option>
				<option value ="fri" {if $strWeekday=="fri"} selected="seleted" {/if}> Friday </option>
			</select>
			<select name="orv">
				<option value="desc"{if $strOrderValue=='desc'} selected="selected"{/if}>Descending</option>
				<option value="asc"{if $strOrderValue=='asc'} selected="selected"{/if}>Ascending</option>
			</select>
			<input type="submit" value="Filter" class="bt" />
		</form>
		<div style="float:right">
		<h2>
			({$intTotal} record{if $intTotal>2}s{/if})
			{if $intTotal>0}
			|
			<a href="{$smarty.const.HOST_ADMIN}/supplier/calendar-export?weekday={$strWeekday}&name={$strName}&orv={$strOrderValue}">Export Supplier</a>
			{/if}
		</h2>

		<form method="post" action="{$smarty.const.HOST_ADMIN}/supplier/save" enctype="multipart/form-data" target="ifrmSupplierData" onsubmit="return doSubmit();">
				<p class="msg error hide" id="null_saledata">File does not exists</p>
				<label>Upload Calendar: </label><input type="file" name="file" readonly="true" />
				<input type="submit" value="Upload Data" class="bt" />
			</form>
		<iframe name="ifrmSupplierData" id="ifrmSupplierData" width="100%" style="display:none"></iframe>
		</div>

	</fieldset>
	{include file="supplier/calendar.result.tpl"}
</div>
<div id="currenttab" class="category_supplier_calendar" style="display: none;">
{include file="styles/footer.tpl"}
{literal}
<script type="text/javascript">
	function wait(id, v)
	{
		return;
		var e	= $('#w_'+id);
		var html= '<img src="img/wait.gif" />';
		if(v=='done'){
			html= '<img src="img/ok.gif" />';
		}
		e.html(html);
	}

	function update_field(id, f)
		{
			var v = $("#" + f +"_" + id).val();		
			
			var idW	= f+'_'+id;
			wait(idW, 'wait');

			$.post
			(
				HOST + '/supplier/update-field/',
				{
					'f'	: f,
					'v'	: v,
					'id': id
				},
				function(data)
				{
					var idW	= f+'_all';
					wait(idW, 'done');
				},
				'json'
			);
	}
	
	function doSubmit()
	{
		showWaiting();
		return true;
	}
	
	function update_done()
	{
		alert('The process is done.');
		window.location.href = HOST + "/supplier/calendar";
		$.unblockUI();
	}
</script>
{/literal}


